<template>
  <div class="news-card">
    <div class="news-card-item" :key="item.id" v-for="item in newsList">
      <div class="left">
        <div class="title">{{ item.title }}</div>
        <div class="other-info">
          <div class="pageviews">
            <van-icon name="browsing-history-o" />
            <span>{{ item.pageviews }}</span>
          </div>
          <div class="time">{{ item.time }}</div>
        </div>
      </div>

      <div class="right">
        <img @load="imgLoad" :src="item.pic" alt="" />
      </div>
    </div>
  </div>
</template>

<script lang="js">
import {defineComponent, reactive, ref} from 'vue'
import emitter from '@/utils/eventbus';
export default defineComponent({
  props: {
    newsList:{
      type:Array,
      default(){
        return []
      }
    }
  },
  components: {

  },
  setup() {
    const imgLoad=()=>{
      emitter.emit('newsLoadFinis')
    }

    return {
      imgLoad
    }

  }
})
</script>

<style scoped lang="less">
.news-card {
  .news-card-item {
    display: flex;
    padding: 2vh 0;
    border-bottom: 1px solid #f0f0f0;
    .left {
      margin-right: 3vw;
      .title {
      }

      .other-info {
        display: flex;
        justify-content: space-between;
        font-size: 3.6vw;
        color: #bfbfbf;
        .time {
          padding-right: 4vw;
        }
      }
    }

    .right {
      img {
        width: 20vw;
      }
    }
  }
}
</style>
